﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace EasyClass {
	public partial class NewTopicForm : Form {
		Controller controller;
		public NewTopicForm(Controller c) {
			InitializeComponent();
			controller = c;
		}

		private void NewTopicForm_Load(object sender, EventArgs e) {

		}

		private void button2_Click(object sender, EventArgs e) {
			Close();
		}

		private void button1_Click(object sender, EventArgs e) {
			try {
				if (!controller.AddTopic(textBox1.Text, textBox5.Text, Int32.Parse(textBox3.Text), Int32.Parse(textBox2.Text), Int32.Parse(textBox4.Text)))
					return;
			} catch (Exception ex) {
				MessageBox.Show("Wrong Format");
				MyConsole.WriteLine(ex.ToString());
				return;
			}
			Close();
		}

	}
}
